import React from 'react';
import {  THEME_COLOR, NAVBAR_BG, SIDEBAR_BG, DARK_THEME } from '@site/common/theme/constants'

const context = React.createContext({});

const initState = {
  activeNavbarBg: '#0b70fb', 
  activeSidebarBg: '#ffffff',
  activeMode: 'light', 
  activeTheme: 'ORANGE_THEME', 
  SidebarWidth: 240,
  routers: []
};

const CustomizerReducer = (state = initState, action) => {
  switch (action.type) {
    case NAVBAR_BG:
      return {
        ...state,
        activeNavbarBg: action.payload,
      };
    case DARK_THEME:
      return {
        ...state,
        activeMode: action.payload,
      };
    case SIDEBAR_BG:
      return {
        ...state,
        activeSidebarBg: action.payload,
      };
    case THEME_COLOR:
      return {
        ...state,
        activeTheme: action.payload,
      };
    default:
      return state;
  }
};

export {
  initState,
  CustomizerReducer,
  context
}
